<?php


namespace App\Sevrice;


use App\Models\HandleModel;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;

class handleLog
{
   static function handleLog($userId,$shopId){
        $arr['user_num']=$userId;
        $arr['shop_num']=$shopId;
        $arr['created_at']=date('Y-m-d H:i:s');
        DB::beginTransaction();
        try {
            HandleModel::insert($arr);
            DB::commit();
        }catch (QueryException $exception){
            DB::rollBack();
           return  ['code'=>400,'msg'=>'添加失败','data'=>$exception];
        }
        return  ['code'=>200,'msg'=>'添加成功'];
    }
}